<!DOCTYPE html>
<?php $this->load->helper('url'); ?>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"  lang="sr-RS"> <!--<![endif]-->
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>HR application • Dynamint</title>
        <meta name="description" content="HR application">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel='shortcut icon' type='image/x-icon' href='/favicon.ico' />
        <!-- Styles -->
        <link rel="stylesheet" href="<?php echo base_url() ?>css/uikit.min.css">
        <link rel="stylesheet" href="<?php echo base_url() ?>css/main.css">
        <link rel="stylesheet" href="<?php echo base_url() ?>css/responsive.css">

        <script src="<?php echo base_url() ?>js/vendor/modernizr-2.6.2.min.js"></script>
    </head>
    <body>
        <!--[if lt IE 7]>
            <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
        <![endif]-->
        <div class="pristup">
            <div class="uk-badge">administrator</div><br/>
        </div>
        <div id="top">
            <div class="uk-container uk-container-center">
                
                <div class="uk-grid">
                    <div class="uk-width-1-4 logo">
                        <div class="uk-width-1-1 "><span>merit</span> plan</div>
                        <div class="uk-width-1-1 logosmall">upravljanje ljudskim resursima<br /> i organizacioni razvoj</div>
                    </div>
                    <div class="uk-width-2-4 uk-text-center"><h2>Spisak korisnika</h2><p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr</p></div>
                    <div class="uk-width-1-4">
                        <div class="uk-grid uk-text-right usertop">
                            <div class="uk-width-3-4"><?php echo $user[0]->first_name ?> <?php echo $user[0]->last_name ?>
                                <?php if ($user[0]->user_level==2): ?>
                                <div class="useruloga">
                                    <div class="uk-badge uk-badge-warnning">supervizor</div>
                                </div>
                                <?php endif; ?>
                                 <?php if ($user[0]->user_level==3): ?>
                                <div class="useruloga">
                                    <div class="uk-badge">administrator</div>
                                </div>
                                <?php endif; ?>
                            </div>
                            <div class="uk-width-1-4 uk-text-center"><span class="uk-icon-user"></span></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    <!--<div id="menu">     
        <div class="uk-container uk-container-center">
            <nav class="uk-navbar">
                <ul class="uk-navbar-nav">
                <?php if ($user[0]->user_level>=2): ?>
                    <li><a href="<?php echo base_url() ?>humanresources/kompanije" class="uk-navbar-nav-subtitle">Kompanije<div>i sektori</div></a></li>
                <?php endif; ?>    
                    <li data-uk-dropdown><a href="<?php echo base_url() ?>humanresources/profil_korisnika" class="uk-navbar-nav-subtitle">Profil<div>korisnika</div></a>
                <?php if ($user[0]->user_level>=1): ?>    
                        <div class="uk-dropdown">
                            <ul class="uk-nav uk-nav-dropdown">
                                <li><a href="<?php echo base_url() ?>humanresources/izmeni_profil" class="">Izmeni Profil</a></li>
                            </ul>
                        </div>
                <?php endif; ?>        
                    </li>
                <?php if ($user[0]->user_level>=1): ?>    
                    <li data-uk-dropdown><a href="<?php echo base_url() ?>humanresources/opis_posla" class="uk-navbar-nav-subtitle">Opis posla<div>upitnik</div></a>
                        <div class="uk-dropdown">
                            <ul class="uk-nav uk-nav-dropdown">
                                <li><a href="<?php echo base_url() ?>humanresources/primeri" class="">Primeri</a></li>
                            </ul>
                        </div>
                    </li>
                    <li><a href="<?php echo base_url() ?>humanresources/finalna_verzija" class="uk-navbar-nav-subtitle">Opis Posla<div>verzija 1</div></a></li>
                    <li><a href="<?php echo base_url() ?>humanresources/finalna_verzija_nova" class="uk-navbar-nav-subtitle">Opis Posla<div>verzija 2</div></a></li><?php endif; ?>  
                
                <?php if ($user[0]->user_level>=2): ?>     
                    <li  class="uk-active" data-uk-dropdown><a href="<?php echo base_url() ?>humanresources/spisak_korisnika" class="uk-navbar-nav-subtitle">Lista korisnika<div></div></a>
                        <div class="uk-dropdown">
                            <ul class="uk-nav uk-nav-dropdown">
                                <li  class="uk-active"><a href="<?php echo base_url() ?>humanresources/spisak_korisnika" class="">Lista korisnika</a></li>
                                <li><a href="<?php echo base_url() ?>humanresources/dodaj_korisnika" class="">Dodaj korisnika</a></li>
                            </ul>
                        </div>
                    </li>
                <?php endif; ?>    
                    
                </ul>
                <div class="uk-navbar-flip">
                    <ul class="uk-navbar-nav">
                        <li><a href="<?php echo base_url() ?>humanresources/userLogout">Logout</a></li>
                    </ul>
                </div>
            </nav>
        </div>
    </div>-->
    <?php echo $menu ?>
        <div id="main">
            <div class="uk-container uk-container-center">

            <div class="uk-grid">
                <div class="uk-width-1-1 uk-text-center">
                <p>Ovu stranu vide administratori i delimicno Supervizori</p>
                <p>Supervizor vidi samo korisnike iz svog sektora</p>

                </div>
                    <div class="uk-width-1-1">
                    
                        <div class="uk-panel uk-panel-box uk-panel-box-secondary">
                            <h3 class="uk-panel-title"><i class="uk-icon-cog"></i> Korisnici: <?php echo $this->Users->getNumUsers(); ?></h3>
                            <table id="spisak" class="uk-table uk-table-striped ikone">
                                
                                <thead>
                                    <tr>
                                        <th colspan="7">Osnovni podaci</th>
                                        <th colspan="4">Upitnik</th>
                                        <th colspan="2">Korisnik</th>
                                    </tr>
                                    <tr>
                                        <th>br</th>
                                        <th>St.</th>
                                        <th>Uloga</th>
                                        <th>Ime</th>
                                        <th>Prezime</th>
                                        <th>Kompanija</th>
                                        <th>Sektor</th>
                                        <th class="malo">popunjen</th>
                                        <th class="malo">Izmenjen</th>
                                        <th class="malo">prihvaćen</th>
                                        <th class="malo">odobren</th>                                        
                                        <th>Obriši</th>
                                        <th>Uredi</th>
                                    </tr>
                                </thead>
                                 <tbody>
                                
                                
                                <?php foreach ($users as $usr):?>
                                    <tr>
                                        <td><?php echo $usr->id; ?></td>    
                                        <td>
                                        <?php if ($usr->user_level==0): ?>
                                            <div class="uk-icon-times-circle  firstred"></div>
                                        <?php else: ?> 
                                            <div class="uk-icon-check-circle green"></div>   
                                        <?php endif; ?>                                        
                                        </td>
                                        <td>
                                        <?php if ($usr->user_level==0): ?>
                                            <div class="uk-badge uk-badge-danger">Reg</div>
                                        <?php endif; ?> 
                                        <?php if ($usr->user_level==1): ?>
                                            <div class="uk-badge uk-badge-success">Korisnik</div>
                                        <?php endif; ?> 
                                        <?php if ($usr->user_level==2): ?>
                                            <div class="uk-badge uk-badge-warning">Supervizor</div>
                                        <?php endif; ?> 
                                        <?php if ($usr->user_level==3): ?>
                                            <div class="uk-badge">Admin</div>
                                        <?php endif; ?>
                                        </td>
                                        <td><?php echo $usr->first_name ?></td>
                                        <td><?php echo $usr->last_name ?></td>
                                        <td><?php echo $usr->company_name ?></td>     
                                        <td><?php echo $usr->sector_name ?></td> 
                                        <td>
                                        <!--<?php if ($usr->user_id): ?>                                            
                                            <div class="uk-icon-check-circle green"></div>
                                        <?php else: ?> 
                                            <div class="uk-icon-times-circle red"></div>
                                        <?php endif; ?>--> 
                                        <?php //var_dump($usr->user_id); ?>                                       
                                        <?php if (($usr->user_id && $user[0]->user_level==3) || ($usr->user_id && $user[0]->user_level==2)): ?>   
                                            <?php if($usr->user_id && $user[0]->user_level==3): ?>  
                                                <a href="<?php echo base_url() ?>humanresources/izmeni_upitnik_korisnika/<?php echo $usr->user_id ?>" ><div class="uk-icon-check-circle green"></div></a>
                                            <?php else: ?> 
                                                <div class="uk-icon-check-circle green">
                                            <?php endif; ?>
                                        <?php else: ?> 
                                            <div class="uk-icon-times-circle red"></div>
                                        <?php endif; ?>
                                        </td>
                                        </td> 

                                        <td>
                                        <?php //var_dump($usr->status); ?>
                                        <?php if (($usr->user_id && $user[0]->user_level==3 && $usr->status>=1) || ($usr->user_id && $user[0]->user_level==2 && $usr->status>=1)): ?>
                                            <?php if($usr->user_id && $user[0]->user_level==2 && $usr->status>=1): ?>  
                                                <a href="<?php echo base_url() ?>humanresources/izmeni_upitnik_korisnika/<?php echo $usr->user_id ?>" ><div class="uk-icon-check-circle green"></div></a>
                                            <?php else: ?> 
                                                <div class="uk-icon-check-circle green">
                                            <?php endif; ?>
                                        <?php else: ?> 
                                            <div class="uk-icon-times-circle red"></div>
                                        <?php endif; ?>
                                        </td>

                                        <td>
                                        <?php if ($usr->status==2 || $usr->status==3): ?>
                                            <?php if ($user[0]->user_level==3): ?>
                                                <!--<a href="<?php echo base_url() ?>humanresources/finalna_verzija_nova/<?php echo $usr->user_id ?>" ><div class="uk-icon-check-circle green"></div></a>-->
                                                <a href="<?php echo base_url() ?>humanresources/izmeni_upitnik_korisnika/<?php echo $usr->user_id ?>" ><div class="uk-icon-check-circle green"></div></a>
                                            <?php else: ?> 
                                                <div class="uk-icon-check-circle green"></div>
                                            <?php endif; ?>
                                        <?php else: ?> 
                                            <div class="uk-icon-times-circle red"></div>
                                        <?php endif; ?>
                                        </td> 
                                        <td>
                                        <?php if ($usr->status==3): ?>                                                                                   
                                            <div class="uk-icon-check-circle green"></div>
                                        <?php else: ?> 
                                            <div class="uk-icon-times-circle red"></div>
                                        <?php endif; ?>
                                        </td>  
                                       
                                        <td>
                                        <?php if ($user[0]->user_level==3): ?>                                            
                                            <a href="<?php echo base_url() ?>humanresources/deleteUser/<?php echo $usr->id ?>" ><div class="red uk-icon-exclamation-circle"></div></a>
                                        <?php else: ?> 
                                            <div class="uk-icon-times-circle red"></div>
                                        <?php endif; ?>
                                        </td> 
                                        <td>

                                        <?php if ($user[0]->user_level==3): ?>                                            
                                            <a href="<?php echo base_url() ?>humanresources/izmeni_korisnika/<?php echo $usr->id ?>" ><div class=" green uk-icon-pencil"></div></a>
                                        <?php else: ?> 
                                            <div class="uk-icon-times-circle red"></div>
                                        <?php endif; ?>
                                        </td> 
                                        
                                        
                                    </tr>                                                               
                                <?php endforeach;?> 
                                
                                </tbody>
                            </table>
                            <div class="uk-width-1-1">
                            <?php echo $links;?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>  

        <div id="futer">
            <div class="uk-container uk-container-center uk-text-center">
 Merit Plan &copy; 2013 
            </div>
        </div>
        <!-- Modals -->
        <div class="uk-modal obrisi-korisnika">
            <div class="uk-modal-dialog uk-text-center">
                <a class="uk-modal-close uk-close"></a>
                <p></p>
                <p>Da li ste sigurni da želite da obrišete korisnika? </p>
                <p>Ova akcija je nepovratna</p>
                <p></p>
                <form method="post" action="<?php echo base_url();?>humanresources/deleteUser ">
                    <input type="submit" class="uk-button-success uk-button" value=" Da ">
                    <input type="button" class="uk-button-danger uk-button uk-modal-close" value=" Ne ">
                <p></p>
                </form>
            </div>
        </div>
        <!-- Scripts -->
        <script src="<?php echo base_url() ?>js/vendor/jquery-1.10.2.min.js"></script>
        <script src="<?php echo base_url() ?>js/vendor/uikit.min.js"></script>
        <script src="<?php echo base_url() ?>js/plugins.js"></script>
        <script src="<?php echo base_url() ?>js/main.js"></script>
        <script type="text/javascript">
        $('.brisanje').on('click', 'button', function(event) {
            event.preventDefault();
            /* Act on the event */
            $(this).parent().find('input').prependTo('.obrisi-korisnika form');

        });
        $('tr').each(function(index, el) {
          if ($(this).find('#popunjen div').hasClass('popunjen')) {
                $(this).find('.popunjeno input.uk-button').removeAttr('disabled');
                $(this).find('.upitnik input.uk-button').removeAttr('disabled');
            } else{
                $(this).find('.popunjeno input.uk-button').attr('disabled', 'disabled');
                $(this).find('.upitnik input.uk-button').attr('disabled', 'disabled');
            }; 
            if ($(this).find('#prihvacen div').hasClass('prihvacen')) {
                $(this).find('.prihvaceno input.uk-button').removeAttr('disabled');
            } else{
                $(this).find('.prihvaceno input.uk-button').attr('disabled', 'disabled');
            };
             if ($(this).find('#odobren div').hasClass('odobren')) {
                $(this).find('.odobreno input.uk-button').removeAttr('disabled');
            } else{
                $(this).find('.odobreno input.uk-button').attr('disabled', 'disabled');
            };

        });
        
        </script>

        <!-- Google Analytics -->

    </body>
</html>
